<template>
  <div class="app-container">
    <div class="page-card top-tabs">
      <el-tabs v-model="activeName">
        <el-tab-pane label="成绩统计" name="cjtj"></el-tab-pane>
        <el-tab-pane label="上线信息" name="sxxx" :xmxx="xmxx"></el-tab-pane>
        <el-tab-pane label="生成内容" name="scnr" :xmxx="xmxx"></el-tab-pane>
      </el-tabs>
    </div>

    <component
      ref="component"
      v-if="xmxx.id"
      :xmxx="xmxx"
      :is="activeName"
    ></component>
  </div>
</template>

<script>
import cjtj from "./components/cjtj.vue";
import sxxx from "./components/sxxx.vue";
import scnr from "./components/scnr.vue";
export default {
  name: "Project_cjtj",
  components: {
    cjtj: cjtj,
    sxxx: sxxx,
    scnr: scnr,
  },
  data() {
    return {
      firstLoad: true,
      loading: false,
      xmxx: {},

      activeName: "cjtj",
    };
  },
  created() {
    this.$store.dispatch("getXmxx").then((res) => {
      this.xmxx = res;
    });
  },
  activated() {
    if (!this.firstLoad) {
      this.$refs.component.getList();
    }
    this.firstLoad = false;
  },
  methods: {},
  deactivated() {
    if (this.activeName == "scnr") {
      this.$refs.component.endTime();
    }
  },
};
</script>

